﻿using System;
using System.Collections.Generic;

namespace Mbs.Elements
{

   /// <summary>
   /// 命令对象接口
   /// </summary>
    public interface IElementCommand:IDisposable
    {
        /// <summary>
        /// 命令名称
        /// </summary>
        string CommandName { get;}

        /// <summary>
        /// 是否可用
        /// </summary>
        bool? Enabled { get; set; }

        /// <summary>
        /// 是否可见
        /// </summary>
        bool? Visible { get; set; }

        /// <summary>
        /// 把对象上的事件附加到消息总线上
        /// </summary>
        /// <param name="owner">对象</param>
        /// <param name="event">事件</param>
        /// <returns></returns>
        IDisposable Attach(object owner, string @event);

        /// <summary>
        /// 返回注册该命令的所有桥接元素集合
        /// </summary>
        /// <typeparam name="TElement"><see cref="IElement"/></typeparam>
        /// <returns></returns>
        List<TElement> Get<TElement>() where TElement : IElement;

        /// <summary>
        /// 移除桥接元素
        /// </summary>
        /// <param name="element">桥接元素</param>
        /// <returns>返回<see cref="IElement"/>实现部分的事件</returns>
        string RemoveElement(IElement element);
    }

}

